package org.apache.flink.runtime.resourceconsumer.factories;

import java.util.UUID;

import org.apache.flink.api.common.ConsumerID;
import org.apache.flink.runtime.resourceconsumer.DefaultResourceConsumerServiceProcess;
import org.apache.flink.runtime.resourceconsumer.ResourceConsumerServiceProcess;

/**
 * @类名: DefaultResourceConsumerServiceProcessFactory
 * @说明: ResourceConsumerServiceProcess工厂
 *
 * @author   leehom
 * @Date	 2023年10月31日 上午10:21:59
 * 修改记录：
 *
 * @see 	 
 */
public class DefaultResourceConsumerServiceProcessFactory implements ResourceConsumerServiceProcessFactory {

    /** 资源消费者Id*/
    private final ConsumerID consumerId;
    /** 资源消费者服务工厂*/
    private final ResourceConsumerServiceFactory resourceConsumerServiceFactory;

    public DefaultResourceConsumerServiceProcessFactory(
            ConsumerID consumerId,
            ResourceConsumerServiceFactory resourceConsumerServiceFactory) {
        this.consumerId = consumerId;
        this.resourceConsumerServiceFactory = resourceConsumerServiceFactory;
    }

    @Override
    public ResourceConsumerServiceProcess create(UUID leaderSessionId) {
        return new DefaultResourceConsumerServiceProcess(
                consumerId,
                leaderSessionId,
                resourceConsumerServiceFactory);
    }

    @Override
    public ConsumerID getConsumerId() {
        return consumerId;
    }

}
